package com.coderman.infosys.auth.domain.factory;

import com.coderman.infosys.auth.domain.bo.authority.RoleAuthAggregateBO;
import com.coderman.infosys.auth.domain.bo.authority.UserAuthAggregateBO;
import com.coderman.infosys.auth.domain.bo.authority.AuthorityBO;
import com.coderman.infosys.auth.domain.gataway.AuthorityQueryGataWay;
import com.coderman.infosys.auth.domain.gataway.UserRoleQueryGataway;
import com.coderman.infosys.auth.domain.repository.AuthorityRepository;

import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Set;

/**
* @Description:AuthorityFactory类
* @Author:shenshuai
* @CreateTime:2022-01-02 15:27:38
* @version v1.0
*/
@Service
public class AuthorityFactory{

   /**  **/
   @Autowired
   private AuthorityRepository authorityRepository;

   @Autowired
   private AuthorityQueryGataWay authorityQueryGataWay;

   @Autowired
   private UserRoleQueryGataway userRoleQueryGataway;


   /**
    *
    * @Description 基于权限本身的维度-权限编码构建权限模
    * @param authorityCode
    * @return AuthorityBO
    */
   public AuthorityBO buildAuthorityByCode(String authorityCode){
       AuthorityBO authorityBO = authorityRepository.getByCode(authorityCode);

       return authorityBO;
   }

   /**
    *
    * @Description 基于用户的维度构建权限模
    * @param userId
    * @return UserAuthAggregateBO
    */
   public UserAuthAggregateBO buildAuthorityWithUser(Long userId){

       return null;
   }


    /**
     *
     * @Description 基于角色的维度构建权限模
     * @param roleCode
     * @return UserAuthAggregateBO
     */
    public RoleAuthAggregateBO buildAuthorityWithRoleCode(String roleCode){

        return null;
    }





}